package org.WhyMCA.WhyMCANews;

/**
@author Danilo '' Riso >> danilo DOT riso AT gmail DOT com
* @author Androidiani Dev Team
* @version 1.0
*/

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;

import org.WhyMCA.WhyMCANews.Splashscreen;
import org.WhyMCA.Utils.DialogMgr.DialogCallback;
import org.WhyMCA.Utils.Global;
import org.WhyMCA.Utils.XMLParser;
import org.WhyMCA.Utils.DialogMgr;
import org.WhyMCA.WhyMCANews.R;
import org.WhyMCA.Utils.PreferencesMgr;
import org.WhyMCA.Adapters.WhyMCAAdapter;
import org.WhyMCA.Models.WhyMCANewsModel;
import org.WhyMCA.Services.WhyMCAService;
import org.WhyMCA.Services.WhyMCAService.OnServiceListener;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.os.Bundle;
import android.text.Html;
import android.text.method.ScrollingMovementMethod;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import org.xmlpull.v1.XmlPullParserException;

public class ViewPost extends Activity {

	private TextView _posttitle, _posttext;
	private static int _pos;
			
	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Global.setCtx(this);
        setContentView(R.layout.view_post);
              
        createElements();
        setText();
    }
      
    public static void setPosition(int position) {
    	
    	_pos = position;
    	
    }
    
    private void createElements() {
    	
    	_posttitle = (TextView) findViewById(R.id.textView1);
    	_posttext = (TextView) findViewById(R.id.textView2);
    	        
	}
    
    private void setText() {
    	
    	_posttitle.setText(WhyMCANews.getModelObject().get(_pos).getTitle());
    	_posttext.setText(Html.fromHtml(WhyMCANews.getModelObject().get(_pos).getDescription()));
    	_posttext.setMovementMethod(new ScrollingMovementMethod()); 
    	
    }
   
}